package com.zkthink.ceres.promotion.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zkthink.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 分销员
 * </p>
 *
 * @author kellen
 * @since 2020-08-22
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_sales_order")
@ApiModel(value = "SalesOrder", description = "分销员")
@AllArgsConstructor
public class SalesOrder extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @NotEmpty(message = "订单号不能为空")
    @Length(max = 16, message = "订单号长度不能超过16")
    @TableField(value = "order_no", condition = LIKE)
    @Excel(name = "订单号")
    private String orderNo;

    /**
     * 客户id
     */
    @ApiModelProperty(value = "客户id")
    @NotNull(message = "客户id不能为空")
    @TableField("mid")
    @Excel(name = "客户id")
    private Long mid;

    /**
     * 订单实付金额
     */
    @ApiModelProperty(value = "订单实付金额")
    @NotNull(message = "订单实付金额不能为空")
    @TableField("order_amount")
    @Excel(name = "订单实付金额")
    private Long orderAmount;

    /**
     * 分销员id
     */
    @ApiModelProperty(value = "分销员id")
    @NotNull(message = "分销员id不能为空")
    @TableField("sid")
    @Excel(name = "分销员id")
    private Long sid;

    /**
     * 利益归属人分销员id
     */
    @ApiModelProperty(value = "利益归属人分销员id")
    @NotNull(message = "利益归属人分销员id不能为空")
    @TableField("profit_sid")
    @Excel(name = "利益归属人分销员id")
    private Long profitSid;

    /**
     * 佣金类型 1直接佣金 2间接佣金
     */
    @ApiModelProperty(value = "佣金类型 1直接佣金 2间接佣金")
    @NotNull(message = "佣金类型 1直接佣金 2间接佣金不能为空")
    @TableField("type")
    @Excel(name = "佣金类型 1直接佣金 2间接佣金")
    private Integer type;

    /**
     * 结算状态 1未结算 2已结算
     */
    @ApiModelProperty(value = "结算状态 1未结算 2已结算")
    @NotNull(message = "结算状态 1未结算 2已结算不能为空")
    @TableField("settle_status")
    @Excel(name = "结算状态 1未结算 2已结算")
    private Integer settleStatus;

    /**
     * 佣金
     */
    @ApiModelProperty(value = "佣金")
    @NotNull(message = "佣金不能为空")
    @TableField("commission")
    @Excel(name = "佣金")
    private Long commission;

    /**
     * 逻辑删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
    @NotNull(message = "逻辑删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "逻辑删除 1-删除 0-未删除")
    private Integer isDelete;

    /**
     * 商户编号
     */
    @ApiModelProperty(value = "商户编号")
    @NotEmpty(message = "商户编号不能为空")
    @TableField(value = "tenant_code", condition = LIKE)
    @Excel(name = "商户编号")
    private String tenantCode;


    @Builder
    public SalesOrder(Long id, LocalDateTime updateTime, Long updateUser, LocalDateTime createTime, Long createUser,
                    String orderNo, Long mid, Long orderAmount, Long sid, Long profitSid, Integer type,
                    Integer settleStatus, Long commission, Integer isDelete, String tenantCode) {
        this.id = id;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createTime = createTime;
        this.createUser = createUser;
        this.orderNo = orderNo;
        this.mid = mid;
        this.orderAmount = orderAmount;
        this.sid = sid;
        this.profitSid = profitSid;
        this.type = type;
        this.settleStatus = settleStatus;
        this.commission = commission;
        this.isDelete = isDelete;
        this.tenantCode = tenantCode;
    }

}
